_pos = [(_this select 0) select 0, (_this select 0) select 1, 0];
_num = _this select 1;
_rad = _this select 2;

_op = switch (side player) do 
{
    case side0: 
    {
        getMarkerPos format["respawn_%1", side1]
    };
    case side1:
    {
        getMarkerPos format["respawn_%1", side0]
    };
};
if ((_op distance _pos) < 2400) exitWith {player groupChat "Illegal deployment";};

_mp = getMarkerPos format["respawn_%1", side player];
_basepos = [_mp select 0, _mp select 1, 0];

_t = switch (side player) do
{
    case side0:
    {
        _v = createVehicle [side0_uav, _basepos, [], 0, "FLY"];
        _g = createGroup side0;
        _p = _g createUnit [side0_pilot, position player, [], 100, "FORM"];
        [_p] join _g;
        _return = [_v,_p];

        _return
    };
    case side1:
    {
        _v = createVehicle [side1_uav, _basepos, [], 0, "FLY"];
        _g = createGroup side1;
        _p = _g createUnit [side1_pilot, position player, [], 100, "FORM"];
        [_p] join _g;
        _return = [_v,_p];

        _return
    };
};
player groupChat "UAV Enroute";
_vehicle = _t select 0;
_pilot = _t select 1;

_pilot moveInDriver _vehicle;
_pilot move _pos;
_vehicle flyinheight 550;
onMapSingleClick "";
s = [_vehicle, _num] execVM "funcs\kte_uavscan.sqf";
waitUntil {unitReady _pilot};

sleep 720;
_pilot move _basepos;

waitUntil {fuel _vehicle < 0.3};
deleteVehicle _pilot;
deleteVehicle _vehicle;
